<?php
/**
 * Object Relational Persistence Mapping Class for table: Diagnosis
 *
 * @package	com.athena
 * @author	LHV
 */
class Diagnosis extends ORDataObject {

	/**#@+
	 * Fields of table: Diagnosis mapped to class members
	 */
	var $diagnosis_id	= 	'';
	var $vi_name			= 	'';
	var $en_name           =   '';
	/**#@-*/


	/**
	 * DB Table
	 */
	var $_table = 'diagnosis';

	/**
	 * Primary Key
	 */
	var $_key = 'diagnosis_id';
	
	/**
	 * Internal Name
	 */
	var $_internalName = 'diagnosis';

	/**
	 * Handle instantiation
	 */
	function Diagnosis() {
		parent::ORDataObject();
	}
	
	public function getDiagnosisList(){
	    $field     =   L10nHelper::changeField(L10nHelper::getLocale(), 'name');
		
		$ds		=	& new Datasource_sql();
		$sql	=	array(
			'cols'	=>	"$this->_key as id, t.$field as name",
			'from'	=>	"$this->_table t",
			'orderby' =>"name"
		);
		$ds->setup($this->_db, $sql);
		return $ds->toArray('id', 'name');
	}
	
	public function deleteDiagnosis($id) {
		$sql = "delete from $this->_table where $this->_key = $id";
		$this->_execute($sql);
	}

}
?>
